<?php
/**
 * Created by PhpStorm.
 * Script Name: EventPrivateChat.php
 * Create: 3/19/22 11:14 PM
 * Description:
 * Author: fudaoji<fdj@kuryun.cn>
 */

namespace plugin\wechat\app\bot\handler\cat;

use plugin\wechat\app\bot\handler\HandlerPrivateChat;
use plugin\wechat\app\service\Bot as BotService;
use plugin\wechat\app\service\BotForward as ForwardService;
use plugin\wechat\app\service\BotFriend as FriendService;
use plugin\wechat\app\service\BotReply as ReplyService;

class EventPrivateChat extends HandlerPrivateChat
{
    /**
     * 私聊消息接收器
     */
    public function handle(){
        $this->friend = FriendService::getMember($this->fromWxid, $this->bot['uin']);
        $this->basic();
        $this->addon();
    }

    /**
     * 基本处理
     * Author: fudaoji<fdj@kuryun.cn>
     */
    public function basic(){
        $this->beAdded();

        //消息转播
        $this->forward();

        switch ($this->content['type']){
            case BotService::MSG_TEXT:
                $this->keyword();
                break;
        }

        //针对消息事件的特殊响应
        $this->eventReply();
    }
}